# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'date'
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'

module Google
  module Apis
    module ChromewebstoreV2
      
      # Request message for CancelSubmission.
      class CancelSubmissionRequest
        include Google::Apis::Core::Hashable
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
        end
      end
      
      # Response message for `CancelSubmission`.
      class CancelSubmissionResponse
        include Google::Apis::Core::Hashable
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
        end
      end
      
      # Deployment information for a specific release channel. Used in requests to
      # update deployment parameters.
      class DeployInfo
        include Google::Apis::Core::Hashable
      
        # Required. The current deploy percentage for the release channel (nonnegative
        # number between 0 and 100).
        # Corresponds to the JSON property `deployPercentage`
        # @return [Fixnum]
        attr_accessor :deploy_percentage
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @deploy_percentage = args[:deploy_percentage] if args.key?(:deploy_percentage)
        end
      end
      
      # Deployment information for a specific release channel
      class DistributionChannel
        include Google::Apis::Core::Hashable
      
        # The extension version provided in the manifest of the uploaded package.
        # Corresponds to the JSON property `crxVersion`
        # @return [String]
        attr_accessor :crx_version
      
        # The current deploy percentage for the release channel (nonnegative number
        # between 0 and 100).
        # Corresponds to the JSON property `deployPercentage`
        # @return [Fixnum]
        attr_accessor :deploy_percentage
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @crx_version = args[:crx_version] if args.key?(:crx_version)
          @deploy_percentage = args[:deploy_percentage] if args.key?(:deploy_percentage)
        end
      end
      
      # Response message for `FetchItemStatus`.
      class FetchItemStatusResponse
        include Google::Apis::Core::Hashable
      
        # Output only. The ID of the item.
        # Corresponds to the JSON property `itemId`
        # @return [String]
        attr_accessor :item_id
      
        # Output only. The state of the last async upload for an item. Only set when
        # there has been an async upload for the item in the past 24 hours.
        # Corresponds to the JSON property `lastAsyncUploadState`
        # @return [String]
        attr_accessor :last_async_upload_state
      
        # The name of the requested item.
        # Corresponds to the JSON property `name`
        # @return [String]
        attr_accessor :name
      
        # The public key of the item, which may be generated by the store.
        # Corresponds to the JSON property `publicKey`
        # @return [String]
        attr_accessor :public_key
      
        # Details on the status of an item revision.
        # Corresponds to the JSON property `publishedItemRevisionStatus`
        # @return [Google::Apis::ChromewebstoreV2::ItemRevisionStatus]
        attr_accessor :published_item_revision_status
      
        # Details on the status of an item revision.
        # Corresponds to the JSON property `submittedItemRevisionStatus`
        # @return [Google::Apis::ChromewebstoreV2::ItemRevisionStatus]
        attr_accessor :submitted_item_revision_status
      
        # If true, the item has been taken down for a policy violation. Check the
        # developer dashboard for details.
        # Corresponds to the JSON property `takenDown`
        # @return [Boolean]
        attr_accessor :taken_down
        alias_method :taken_down?, :taken_down
      
        # If true, the item has been warned for a policy violation and will be taken
        # down if not resolved. Check the developer dashboard for details.
        # Corresponds to the JSON property `warned`
        # @return [Boolean]
        attr_accessor :warned
        alias_method :warned?, :warned
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @item_id = args[:item_id] if args.key?(:item_id)
          @last_async_upload_state = args[:last_async_upload_state] if args.key?(:last_async_upload_state)
          @name = args[:name] if args.key?(:name)
          @public_key = args[:public_key] if args.key?(:public_key)
          @published_item_revision_status = args[:published_item_revision_status] if args.key?(:published_item_revision_status)
          @submitted_item_revision_status = args[:submitted_item_revision_status] if args.key?(:submitted_item_revision_status)
          @taken_down = args[:taken_down] if args.key?(:taken_down)
          @warned = args[:warned] if args.key?(:warned)
        end
      end
      
      # Details on the status of an item revision.
      class ItemRevisionStatus
        include Google::Apis::Core::Hashable
      
        # Details on the package of the item
        # Corresponds to the JSON property `distributionChannels`
        # @return [Array<Google::Apis::ChromewebstoreV2::DistributionChannel>]
        attr_accessor :distribution_channels
      
        # Output only. Current state of the item
        # Corresponds to the JSON property `state`
        # @return [String]
        attr_accessor :state
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @distribution_channels = args[:distribution_channels] if args.key?(:distribution_channels)
          @state = args[:state] if args.key?(:state)
        end
      end
      
      # Request message for PublishItem.
      class PublishItemRequest
        include Google::Apis::Core::Hashable
      
        # Optional. Additional deploy information including the desired initial
        # percentage rollout. Defaults to the current value saved in the developer
        # dashboard if unset.
        # Corresponds to the JSON property `deployInfos`
        # @return [Array<Google::Apis::ChromewebstoreV2::DeployInfo>]
        attr_accessor :deploy_infos
      
        # Optional. Use this to control if the item is published immediately on approval
        # or staged for publishing in the future. Defaults to `DEFAULT_PUBLISH` if unset.
        # Corresponds to the JSON property `publishType`
        # @return [String]
        attr_accessor :publish_type
      
        # Optional. Whether to attempt to skip item review. The API will validate if the
        # item qualifies and return a validation error if the item requires review.
        # Defaults to `false` if unset.
        # Corresponds to the JSON property `skipReview`
        # @return [Boolean]
        attr_accessor :skip_review
        alias_method :skip_review?, :skip_review
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @deploy_infos = args[:deploy_infos] if args.key?(:deploy_infos)
          @publish_type = args[:publish_type] if args.key?(:publish_type)
          @skip_review = args[:skip_review] if args.key?(:skip_review)
        end
      end
      
      # Response message for `PublishItem`.
      class PublishItemResponse
        include Google::Apis::Core::Hashable
      
        # Output only. The ID of the item.
        # Corresponds to the JSON property `itemId`
        # @return [String]
        attr_accessor :item_id
      
        # The name of the item that was submitted
        # Corresponds to the JSON property `name`
        # @return [String]
        attr_accessor :name
      
        # Output only. The current state of the submission.
        # Corresponds to the JSON property `state`
        # @return [String]
        attr_accessor :state
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @item_id = args[:item_id] if args.key?(:item_id)
          @name = args[:name] if args.key?(:name)
          @state = args[:state] if args.key?(:state)
        end
      end
      
      # Request message for SetPublishedDeployPercentage.
      class SetPublishedDeployPercentageRequest
        include Google::Apis::Core::Hashable
      
        # Required. Unscaled percentage value for the publised revision (nonnegative
        # number between 0 and 100). It must be larger than the existing target
        # percentage.
        # Corresponds to the JSON property `deployPercentage`
        # @return [Fixnum]
        attr_accessor :deploy_percentage
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @deploy_percentage = args[:deploy_percentage] if args.key?(:deploy_percentage)
        end
      end
      
      # Response message for `SetPublishedDeployPercentage`.
      class SetPublishedDeployPercentageResponse
        include Google::Apis::Core::Hashable
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
        end
      end
      
      # Request message for UploadItemPackage.
      class UploadItemPackageRequest
        include Google::Apis::Core::Hashable
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
        end
      end
      
      # Response message for `UploadItemPackage`.
      class UploadItemPackageResponse
        include Google::Apis::Core::Hashable
      
        # The extension version provided in the manifest of the uploaded package. This
        # will not be set if the upload is still in progress (`upload_state` is `
        # UPLOAD_IN_PROGRESS`).
        # Corresponds to the JSON property `crxVersion`
        # @return [String]
        attr_accessor :crx_version
      
        # Output only. The ID of the item the package was uploaded to.
        # Corresponds to the JSON property `itemId`
        # @return [String]
        attr_accessor :item_id
      
        # The name of the item the package was uploaded to.
        # Corresponds to the JSON property `name`
        # @return [String]
        attr_accessor :name
      
        # Output only. The state of the upload. If `upload_state` is `UPLOAD_IN_PROGRESS`
        # , you can poll for updates using the fetchStatus method.
        # Corresponds to the JSON property `uploadState`
        # @return [String]
        attr_accessor :upload_state
      
        def initialize(**args)
           update!(**args)
        end
      
        # Update properties of this object
        def update!(**args)
          @crx_version = args[:crx_version] if args.key?(:crx_version)
          @item_id = args[:item_id] if args.key?(:item_id)
          @name = args[:name] if args.key?(:name)
          @upload_state = args[:upload_state] if args.key?(:upload_state)
        end
      end
    end
  end
end
